/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sampleEntity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author ASUS K43E
 */
@Entity
@Table(name = "BookRoom", catalog = "Lafitte", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "BookRoom.findAll", query = "SELECT b FROM BookRoom b"),
    @NamedQuery(name = "BookRoom.findByRoomId", query = "SELECT b FROM BookRoom b WHERE b.bookRoomPK.roomId = :roomId"),
    @NamedQuery(name = "BookRoom.findByOrderDate", query = "SELECT b FROM BookRoom b WHERE b.bookRoomPK.orderDate = :orderDate"),
    @NamedQuery(name = "BookRoom.findByStatus", query = "SELECT b FROM BookRoom b WHERE b.status = :status")})
public class BookRoom implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected BookRoomPK bookRoomPK;
    @Basic(optional = false)
    @Column(name = "status", nullable = false)
    private boolean status;
    @JoinColumn(name = "roomId", referencedColumnName = "roomId", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Room room;
    @JoinColumn(name = "username", referencedColumnName = "username", nullable = false)
    @ManyToOne(optional = false)
    private Customers customers;

    public BookRoom() {
    }

    public BookRoom(BookRoomPK bookRoomPK) {
        this.bookRoomPK = bookRoomPK;
    }

    public BookRoom(BookRoomPK bookRoomPK, boolean status, Room room, Customers customers) {
        this.bookRoomPK = bookRoomPK;
        this.status = status;
        this.room = room;
        this.customers = customers;
    }

    public BookRoom(BookRoomPK bookRoomPK, boolean status) {
        this.bookRoomPK = bookRoomPK;
        this.status = status;
    }

    public BookRoom(String roomId, Date orderDate) {
        this.bookRoomPK = new BookRoomPK(roomId, orderDate);
    }

    public BookRoomPK getBookRoomPK() {
        return bookRoomPK;
    }

    public void setBookRoomPK(BookRoomPK bookRoomPK) {
        this.bookRoomPK = bookRoomPK;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public Room getRoom() {
        return room;
    }

    public void setRoom(Room room) {
        this.room = room;
    }

    public Customers getCustomers() {
        return customers;
    }

    public void setCustomers(Customers customers) {
        this.customers = customers;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bookRoomPK != null ? bookRoomPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BookRoom)) {
            return false;
        }
        BookRoom other = (BookRoom) object;
        if ((this.bookRoomPK == null && other.bookRoomPK != null) || (this.bookRoomPK != null && !this.bookRoomPK.equals(other.bookRoomPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sampleEntity.BookRoom[bookRoomPK=" + bookRoomPK + "]";
    }

}
